Skip to content

Bump: require pydantic-ai 2.40 - #63

Merged
echarles merged 4 commits into
datalayer:mainfrom
datalayer-externals:bump/pydantic-ai-2
Sep 6, 2026
Merged

echarles merged 4 commits into
datalayer:mainfrom
datalayer-externals:bump/pydantic-ai-2

Conversation

@echarles

@echarles echarles commented Sep 5, 2026

Copy link
Copy Markdown
Member

What

  • The pydantic-ai extra now requires pydantic-ai-slim>=2.40.0; the lock moves pydantic-ai-slim and pydantic-graph from 1.93.0 to 2.40.0 (plus pydantic-ai 2's own dependencies: httpx2, httpcore2, truststore).
  • griffe, as pydantic-ai 2 needs it: griffelib 2.3.0 for the library, with the griffe meta-package kept at 1.14. With both at 2.0.2 (what a plain relock gives), griffe ends up without an __init__ and import pydantic_ai fails.
  • That failure was invisible: the bridge tests skip through pytest.importorskip('pydantic_ai'), which treated any ImportError as "not installed", so a broken environment produced a green run with the bridge untested. The skips now pass exc_type=ModuleNotFoundError: a missing module skips, a broken one fails.
  • README note and bridge docstring updated: Pydantic AI 2 is required and agent_to_a2a replaces the removed Agent.to_a2a().

What did not change

No code. The bridge and all its tests pass on 2.40 as they are — the streaming fallback from #62 already covered the one behavioural difference (a non-streaming model's refusal surfaces on the first read rather than on entering the stream). No deprecation warnings from 2.40 in the test run.

Verified locally on Python 3.12 with the new lock (uv sync --frozen --extra pydantic-ai --python 3.12): 34 tests pass with none skipped, pyright strict 0 errors, ruff clean.

🤖 Generated with Claude Code

The `pydantic-ai` extra moves to `pydantic-ai-slim>=2.40.0`, and the lock
follows: pydantic-ai-slim and pydantic-graph 2.40.0, and griffe as pydantic-ai
2 wants it — `griffelib` for the library, with the `griffe` meta-package kept
at 1.x, since at 2.0.2 the two together leave `griffe` without an `__init__`
and `import pydantic_ai` fails.

That failure used to pass unnoticed: the bridge tests skip through
`pytest.importorskip`, which treated any ImportError as "not installed". They
now skip only when the module is missing, so a broken install fails the run.
The README and the bridge docstring say Pydantic AI 2 is required, where they
described the 1.x deprecation of `Agent.to_a2a()`.

No code change was needed: the bridge and its tests pass on 2.40 as they are.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings September 5, 2026 17:41

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The updated pytest.importorskip(..., exc_type=ModuleNotFoundError) can still incorrectly skip when a transitive dependency is missing (also raising ModuleNotFoundError), leaving the bridge untested in some broken environments.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR updates FastA2A’s optional Pydantic AI integration to require Pydantic AI 2 (via pydantic-ai-slim>=2.40.0), refreshes the lockfile for the new dependency set, and updates tests/docs to match the Pydantic AI 2 bridge expectations.

Changes:

  • Bump the pydantic-ai extra to pydantic-ai-slim>=2.40.0 and update uv.lock accordingly (incl. new transitive deps like httpx2/httpcore2/truststore).
  • Update Pydantic-AI-related tests to avoid masking some import failures.
  • Update README and bridge module docstring to reflect that agent_to_a2a replaces removed Agent.to_a2a() in Pydantic AI 2.
File summaries
File Description
uv.lock Refresh lockfile for Pydantic AI 2 / pydantic-ai-slim>=2.40.0 dependency graph.
pyproject.toml Require pydantic-ai-slim>=2.40.0 for the pydantic-ai optional extra.
tests/test_pydantic_ai.py Tighten skip logic around importing pydantic_ai.
tests/test_pydantic_ai_streaming.py Tighten skip logic around importing pydantic_ai for streaming bridge tests.
tests/test_extensions.py Tighten skip logic around importing pydantic_ai in extension-forwarding test.
README.md Document that the bridge requires Pydantic AI 2 and agent_to_a2a replaces Agent.to_a2a().
fasta2a/pydantic_ai/init.py Update bridge module docstring to reflect Pydantic AI 2 API changes.
Review details
  • Files reviewed: 6/7 changed files
  • Comments generated: 3
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread tests/test_extensions.py Resolved
Comment thread tests/test_pydantic_ai.py Resolved
Comment thread tests/test_pydantic_ai_streaming.py Resolved
@echarles echarles changed the title build: require pydantic-ai 2.40 for the bridge Bump: require pydantic-ai 2.40 Sep 6, 2026
echarles and others added 3 commits September 6, 2026 06:41
`importorskip(..., exc_type=ModuleNotFoundError)` still skipped when
pydantic-ai was installed but one of its own dependencies was not, since that
raises ModuleNotFoundError too. The import is now explicit and skips only
when the missing module is `pydantic_ai`; anything else is re-raised.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

@echarles echarles left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@echarles
echarles merged commit 11c8ad3 into datalayer:main Sep 6, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants